package haizhi.fruitmall.action;

import haizhi.fruitmall.pojo.view.ResultView;
import haizhi.fruitmall.service.IndexService;
import haizhi.fruitmall.util.ResultUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Date: 2017/12/23 21:48
 * @Author: Richard Zane
 */

@Slf4j
@Controller
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IndexService indexService;

    @RequestMapping(value = "/getHead",method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public ResultView getHead(){
        return ResultUtil.getSuccess(indexService.getHead());
    }

    @RequestMapping(value = "/getTail",method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public ResultView getTail(){
        return ResultUtil.getSuccess(indexService.getTail());
    }
}
